package servlet;

import vo.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet(value = "/jstl")
public class Demo10_JSTLServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        request.setAttribute("outValue","我是out标签的值");

        request.setAttribute("age",10);

        List userList = new ArrayList<>();
        userList.add(new User("张添齐",20));
        userList.add(new User("曾庆萱",21));
        userList.add(new User("徐豪",22));
        userList.add(new User("马宏泽",23));
        userList.add(new User("梁鑫",24));
        userList.add(new User("开祥鹏",25));
        userList.add(new User("郭苏林",26));
        userList.add(new User("杨绅",27));
        userList.add(new User("于效东",28));
        userList.add(new User("乔继峰",29));

        request.setAttribute("users",userList);


        request.getRequestDispatcher("/jsp/JSTL.jsp").forward(request,response);

    }
}
